home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / emstools.arc / EMMLIB.ARC / EMM21_A.ASM < prev    next >
Assembly Source File  |  1990-02-04  |  7KB  |  121 lines

  1. ;-----------------------------------------------------------------------------;
  2. ;      MODULE NAME:   EMM21_A.ASM                                             ;
  3. ;                                                                             ;
  4. ;    FUNCTION NAME:   get_handle_dir                                          ;
  5. ;                                                                             ;
  6. ;      DESCRIPTION:   This function returns an array containing all           ;
  7. ;                     active handles and the names associated with each.      ;
  8. ;                     Any handles which has not been assigned a name has a    ;
  9. ;                     default name of all ASCII nulls (binary zeros).  When a ;
  10. ;                     handle is first allocated, or when all the pages        ;
  11. ;                     belonging to a handle are deallocated (that is, an open ;
  12. ;                     handle is closed), its default name is set to ASCII     ;
  13. ;                     nulls.  In order to name a handle, you must assign      ;
  14. ;                     the name after the handle has been opened.  The         ;
  15. ;                     full range of values may be assigned to each character  ;
  16. ;                     in a name (that is, 00h through FFh).                   ;
  17. ;                                                                             ;
  18. ;                     The number of bytes required by the array is:           ;
  19. ;                         10 bytes * total number of handles                  ;
  20. ;                                                                             ;
  21. ;                     The maximum size of this array is:                      ;
  22. ;                         (10 bytes/entry) * 255 entries = 2550 bytes         ;
  23. ;                                                                             ;
  24. ;           PASSED:   &hd_count:                                              ;
  25. ;                        is a far pointer to the number of entries in the     ;
  26. ;                        handle directory array of structures.                ;
  27. ;                                                                             ;
  28. ;                     handle_dir:                                             ;
  29. ;                        is a far pointer to a structure into which the       ;
  30. ;                        memory manager will copy the handle directory.  The  ;
  31. ;                        handle directory is an array of structures.  There   ;
  32. ;                        are as many entries in the array of structures as    ;
  33. ;                        there are open EMM handles.                          ;
  34. ;                                                                             ;
  35. ;         RETURNED:   status:                                                 ;
  36. ;                        is the status EMM returns from the call.  All other  ;
  37. ;                        returned results are valid only if the status        ;
  38. ;                        returned is zero.  Otherwise they are undefined.     ;
  39. ;                                                                             ;
  40. ;                     hd_count:                                               ;
  41. ;                        is the number of entries in the handle directory     ;
  42. ;                        structure.  This is also the same as the number of   ;
  43. ;                        open handles.  For example, if only one handle is    ;
  44. ;                        active, hd_count will be 1.                          ;
  45. ;                                                                             ;
  46. ;                     handle_dir:                                             ;
  47. ;                        is a structure which contains the handle values and  ;
  48. ;                        handle names associated with each handle value.      ;
  49. ;                        The structure members are described here:            ;
  50. ;                                                                             ;
  51. ;                        handle_dir.handle:                                   ;
  52. ;                           is the open EMM handle.                           ;
  53. ;                                                                             ;
  54. ;                        handle_dir.name:                                     ;
  55. ;                           is a character array which contains the ASCII     ;
  56. ;                           name associated with the EMM handle.  If there    ;
  57. ;                           is no name currently associated with the handle,  ;
  58. ;                           it has a value of all zeros (ASCII nulls).        ;
  59. ;                                                                             ;
  60. ; C USE CONVENTION:   unsigned int      status;                               ;
  61. ;                     unsigned int      hd_count;                             ;
  62. ;                     HANDLE_DIR_STRUCT handle_dir;                           ;
  63. ;                                                                             ;
  64. ;                     status = get_handle_dir (&hd_count,                     ;
  65. ;                                              handle_dir);                   ;
  66. ;-----------------------------------------------------------------------------;
  67. .XLIST
  68. PAGE    60,132
  69.  
  70. IFDEF SMALL
  71.    .MODEL SMALL, C
  72. ENDIF
  73. IFDEF MEDIUM
  74.    .MODEL MEDIUM, C
  75. ENDIF
  76. IFDEF LARGE
  77.    .MODEL LARGE, C
  78. ENDIF
  79. IFDEF COMPACT
  80.    .MODEL COMPACT, C
  81. ENDIF
  82. IFDEF HUGE
  83.    .MODEL HUGE, C
  84. ENDIF
  85.  
  86. INCLUDE emmlib.equ
  87. INCLUDE emmlib.str
  88. INCLUDE emmlib.mac
  89. .LIST
  90. .CODE
  91.  
  92. get_handle_dir        PROC                                                  \
  93.             USES DI,                                              \
  94.             ptr_handle_dir_count:FAR PTR WORD,                        \
  95.             ptr_handle_dir:FAR PTR BYTE                              
  96.  
  97.     ;---------------------------------------------------------------------;
  98.     ;   do;                                                               ;
  99.     ;   .   get the current "directory" of handle names;                  ;
  100.     ;---------------------------------------------------------------------;
  101.     MOVE        AX, get_handle_dir_fcn
  102.     MOVE        ES:DI, ptr_handle_dir
  103.     INT         EMM_int
  104.  
  105.     ;---------------------------------------------------------------------;
  106.     ;   .   pass the count of "directory" entries back to the caller;     ;
  107.     ;---------------------------------------------------------------------;
  108.     MOVE        DH:DL, 0:AL
  109.     MOVE        ES:BX, ptr_handle_dir_count
  110.     MOVE        ES:[BX], DX
  111.  
  112.     ;---------------------------------------------------------------------;
  113.     ;   .   return (EMM status);                                          ;
  114.     ;   end;                                                              ;
  115.     ;---------------------------------------------------------------------;
  116.     RET_EMM_STAT    AH
  117.  
  118. get_handle_dir        ENDP
  119.  
  120. END
  121.